function request(options) {
  return new Promise((resolve, reject) => {
    new Promise((resolve, reject) => {
      $.ajax({
        url: 'http://localhost:8589/api/' + options.url,
        type: options.type || 'get',
        dataType: options.dataType || 'json',
        data: options.data || {},
        success: res => {
          !options.success && resolve(res)
          options.success && options.success(res)
        },
        fail: err => {
          !options.success && reject(err)
          options.success && options.fail(err)
        },
        beforeSend: options.beforeSend || (() => { }),
        complete: options.complete || (() => { }),
      })
    }).then(res => {
      resolve(res)
    }).catch(err => {
      console.log('请求失败', err)
    })
  })
}